package scuts.core.extensions;

import scuts.core.types.Option;

class Dynamics 
{

  public static function toArrayOption <T>(a:T):Array<Option<T>> 
  {
    return if (a == null) [] else [Some(a)];
  }
  
  public static inline function toOption < T > (v:T):Option<T> {
    return v != null ? Some(v) : None;
  }
  
  
  
  public static inline function isObject (v:Dynamic):Bool {
    return Reflect.isObject(v);
  }
  
  public static function replicateToArray<T>(e:T, num:Int):Array<T> 
  {
    var res = [];
    for (_ in 0...num) {
      res.push(e);
    }
    return res;
  }

  
}